package Chapter8;
import java.io.*;
import java.util.*;
public class Example24 {
	public static void main(String[] args) throws Exception{
		Vector vector=new Vector();
		FileInputStream fis1=new FileInputStream("A.txt");
		FileInputStream fis2=new FileInputStream("stream1.txt");
		FileInputStream fis3=new FileInputStream("stream2.txt");
		vector.addElement(fis1);
		vector.addElement(fis2);
		vector.addElement(fis3);
		Enumeration e=vector.elements();
		SequenceInputStream sis=new SequenceInputStream(e);
		FileOutputStream out=new FileOutputStream("stream.txt");
		int len;
		byte[] buf=new byte[1024];
		while((len=sis.read(buf))!=-1) {
			out.write(buf,0,len);
		}sis.close();
		out.close();

	}

}
